package com.dragon.refect.annotation;

import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.util.Arrays;

/**
 *
 *
 * @author dragon
 * @since 2019/12/2
 */
public class ChildTest {

    public static void main(String[] args) {
        Class<Child> childClass = Child.class;
        // 获取直接存在的注解信息
        Annotation[] declaredAnnotations = childClass.getDeclaredAnnotations();
        System.out.println(Arrays.toString(declaredAnnotations));
        System.out.println("===============================");
        ChildAnnotation[] childAnnotations = childClass.getDeclaredAnnotationsByType(ChildAnnotation.class);
        System.out.println(Arrays.toString(childAnnotations));
        System.out.println("===============================");
        DocumentA[] documentAS = childClass.getDeclaredAnnotationsByType(DocumentA.class);
        System.out.println(Arrays.toString(documentAS));
        System.out.println("===============================");
        Annotation[] annotations = childClass.getAnnotations();
        System.out.println(Arrays.toString(annotations));
        System.out.println("===============================");
        DocumentA[] annotationsByType = childClass.getAnnotationsByType(DocumentA.class);
        System.out.println(Arrays.toString(annotationsByType));
    }
}
